<div class="smart-rightPanel layui-form">
    <div class="layui-anim layui-anim-upbit">
        <blockquote class="site-text layui-elem-quote">
            <div class="layui-form-item wx-search" id="list_form">
                <div class="layui-inline">
                    <label class="layui-form-label">时间段:</label>
                    <div class="layui-input-inline">
                        <input type="text" class="layui-input laydate" id="start" name="start">
                    </div>
                    <i class="iconfont icon-rili"></i>
                </div>
                <span class="font-primary">-</span>
                <div class="layui-inline">
                    <div class="layui-input-inline">
                        <input type="text" class="layui-input laydate" id="end" name="end">
                    </div>
                    <i class="iconfont icon-rili"></i>
                </div>
                <button class="layui-btn btn-primary" id="search">搜索</button>
            </div>
        </blockquote>
        <table id="list_table" class="layui-hide" lay-filter="mainList"></table>
    </div>
</div>
<script>
    layui.use(['layer', 'table', 'form','jquery','laydate'], function () {
        var layer = layui.layer;
        var laydate = layui.laydate;
        var table = layui.table;
        var form = layui.form;
        var  $ = layui.jquery;
        var tableObj = table.render({
            id: 'list_table'
            , elem: '#list_table'
            , url: 'buss/tongji/user'
            , align: "center"
            , cols: [[ //表头
                {field: 'dateId', title: '日期',align: 'center'}
                , {field: 'usernum', title: '注册用户数',  align: 'center'}
                , {field: 'weeknum', title: '周注册数',  align: 'center'}
                , {field: 'yuenum', title: '月注册数',  align: 'center'}
            ]]
        });

        $("#search").click(function () {
            reloadTable(tableObj);
        });

        laydate.render({
            elem: '#start',
            done: function (value, date, endDate) {
                var end = $("#end").val();
                if (value && end && (new Date(end) - new Date(value)) <=0) {
                    $("#start").val("");
                    layer.msg("开始时间需小于结束时间");
                }
            }
        });

        laydate.render({
            elem: '#end',
            done: function (value, date, endDate) {
                var start = $("#start").val();
                if (value && start && (new Date(value) - new Date(start)) <= 0) {
                    $("#end").val("");
                    layer.msg("结束时间需大于开始时间");
                }
            }
        });

    });
</script>

